package com.yuwei.home

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.yuwei.base.BaseViewModel
import com.yuwei.http.entity.NoticeEntity
import com.yuwei.http.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class HomeViewModel @Inject constructor(
    val apiService: ApiService
): BaseViewModel() {
    val getNoticeSuccess by lazy { MutableLiveData<NoticeEntity>() }
    fun getNotice(page : Int,size : Int){
        viewModelScope.launch {
            executeNetwork({
                apiService.getNotice(page, size)
            },getNoticeSuccess::postValue)
        }
    }
}